package com.joseph.order.controller;

import com.alibaba.fastjson.JSON;
import com.joseph.common.result.RpcResult;
import com.joseph.user.feign.UserClient;
import com.joseph.user.dto.response.UserRsp;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

@RestController
@AllArgsConstructor
@Slf4j
public class OrderController {

    private final UserClient userClient;

    @GetMapping("getOrder")
    public void getUserOrder(@NotNull( message = "111111") String orderId) {
        RpcResult<UserRsp> userById = userClient.getUserById(1);
        userById.checkRpcResult();
        System.out.println(JSON.toJSONString(userById));
        if (userById.getData() == null) {
            System.out.println(1);
        }
    }

}
